// 1.
const Koa = require('koa');
const static = require('koa-static');
const router = require('koa-router');

let server = new Koa();

server.listen(8080);

// 计算页面响应时间
server.use(async (ctx,next)=>{
    let start = new Date().getTime();

    await next();

    console.log(`处理时间：${new Date().getTime()-start}ms`);

})


server.use(async (ctx,next)=>{
    try {console.log(111222)
        await next();
    } catch (error) {
        console.log(111)
        ctx.response.body='404';
    }
})


server.use(static('./www'));